# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=urfkill
pkgver=0.5.0_git20210401
pkgrel=5
_commit="333a29d5d7b09c4ae296ec37d9c6aaaf1b8f539b"
pkgdesc="Handle rfkill events in userspace"
url="https://freedesktop.org/wiki/Software/urfkill/"
arch="all"
license="GPL-2.0-or-later AND LGPL-2.1-or-later"
depends_dev="
	dbus-glib-dev
	eudev-dev
	expat-dev
	gobject-introspection-dev
	polkit-elogind-dev
	"
makedepends="
	$depends_dev
	autoconf
	automake
	dbus-dev
	glib-dev
	gtk-doc
	intltool
	xz
	"
subpackages="$pkgname-static $pkgname-dev $pkgname-doc $pkgname-openrc"
source="https://github.com/lcp/urfkill/archive/$_commit/urfkill-$_commit.tar.gz
	urfkill.initd
	urfkill.confd
	"
builddir="$srcdir/urfkill-$_commit"
options="!check" # Fails with translations check

build() {
	NOCONFIGURE=1 ./autogen.sh
	./configure \
		--prefix=/usr \
		--sysconfdir=/etc \
		--localstatedir=/var
	make
}

check() {
	make check
}

package() {
	DESTDIR="$pkgdir" make install
	mkdir -p "$pkgdir"/var/lib/urfkill

	install -Dm755 "$srcdir"/urfkill.initd "$pkgdir"/etc/init.d/urfkill
	install -Dm644 "$srcdir"/urfkill.confd "$pkgdir"/etc/conf.d/urfkill

	mkdir -p "$pkgdir"/usr/share/dbus-1/system.d/
	mv "$pkgdir"/etc/dbus-1/system.d/* "$pkgdir"/usr/share/dbus-1/system.d/
}

sha512sums="
f45104a4016a32af4616a03c7395ce65667b797f953ea18573d8f859099000e611fd9c734da7c82cd8b8782220a398d81659300984c6ad1ef091a0c30c5094bd  urfkill-333a29d5d7b09c4ae296ec37d9c6aaaf1b8f539b.tar.gz
7126aaa8d4d47e6cd0b5bceacc0508db7a4b70a1ce50aa2ffe7eb0043923d08b959f05a2246389f66270c91c2c43efc1c7349e8a01897a239af89af1065fe1ee  urfkill.initd
b841282b96110ec59a7aa539db0737327b09549d55c78dc4b2c3b28b4a6ad1facf015b3175cb6d3a38f13e47aa6314ef3dc1514a4e60dd653a97409ec54ba706  urfkill.confd
"
